﻿package com.doue.interactive
{
	//要使用場景裡的movieclip，一定先import
	import flash.display.MovieClip;
	//要使用MouseEvent，一定先import
	import flash.events.MouseEvent;
	
	
	//Class名稱一定要跟.as名稱一樣
	public class DragDrop extends MovieClip
	{
/*		public var target:MovieClip;
		private var originalX:Number;
		private var originalY:Number;
		//private var offset:Point;*/
		
		public function DragDrop()
		{
/*			originalX = this.x;
			originalY = this.y;*/
			this.addEventListener(MouseEvent.MOUSE_DOWN, drag);
		}
		
		private function drag(event:MouseEvent):void
		{
			this.startDrag();
			this.parent.addChild(this);
			this.addEventListener(MouseEvent.MOUSE_UP, drop);
		}
		
		private function drop(event:MouseEvent):void
		{
			this.stopDrag();
			this.removeEventListener(MouseEvent.MOUSE_UP, drop);
			
		}
	}
}